/*
 * @(#)SerializedFormWriter.java 1.4 03/12/19
 * 
 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. SUN
 * PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package com.sun.tools.doclets.internal.toolkit;

import com.sun.javadoc.*;
import java.io.*;

/**
 * The interface for writing serialized form output.
 * 
 * This code is not part of an API. It is implementation that is subject to
 * change. Do not use it as an API
 * 
 * @author Jamie Ho
 * @since 1.5
 */

public interface SerializedFormWriter {
	
	/**
	 * Write the given header.
	 * 
	 * @param header the header to write.
	 */
	public void writeHeader(String header);
	
	/**
	 * Write the given package header.
	 * 
	 * @param packageName the package header to write.
	 */
	public void writePackageHeader(String packageName);
	
	/**
	 * Write the heading for the serializable class.
	 * 
	 * @param classDoc the class being processed.
	 */
	public void writeClassHeader(ClassDoc classDoc);
	
	/**
	 * Write the serial UID info.
	 * 
	 * @param header the header that will show up before the UID.
	 * @param serialUID the serial UID to print.
	 */
	public void writeSerialUIDInfo(String header, String serialUID);
	
	/**
	 * Return an instance of a SerialFieldWriter.
	 * 
	 * @return an instance of a SerialFieldWriter.
	 */
	public SerialFieldWriter getSerialFieldWriter(ClassDoc classDoc);
	
	/**
	 * Return an instance of a SerialMethodWriter.
	 * 
	 * @return an instance of a SerialMethodWriter.
	 */
	public SerialMethodWriter getSerialMethodWriter(ClassDoc classDoc);
	
	/**
	 * Close the writer.
	 */
	public abstract void close() throws IOException;
	
	/**
	 * Write the footer.
	 */
	public void writeFooter();
	
	/**
	 * Write the serialized form for a given field.
	 */
	public interface SerialFieldWriter {
		
		/**
		 * Write the given heading.
		 * 
		 * @param heading the heading to write.
		 */
		public void writeHeader(String heading);
		
		/**
		 * Write the deprecated information for this member.
		 * 
		 * @param field the field to document.
		 */
		public void writeMemberDeprecatedInfo(FieldDoc field);
		
		/**
		 * Write the description text for this member.
		 * 
		 * @param field the field to document.
		 */
		public void writeMemberDescription(FieldDoc field);
		
		/**
		 * Write the description text for this member represented by the tag.
		 * 
		 * @param serialFieldTag the field to document (represented by tag).
		 */
		public void writeMemberDescription(SerialFieldTag serialFieldTag);
		
		/**
		 * Write the tag information for this member.
		 * 
		 * @param field the field to document.
		 */
		public void writeMemberTags(FieldDoc field);
		
		/**
		 * Write the member header.
		 * 
		 * @param fieldType the type of the field.
		 * @param fieldTypeStr the type of the field in string format. We will
		 *        print this out if we can't link to the type.
		 * @param fieldDimensions the dimensions of the field.
		 * @param fieldName the name of the field.
		 */
		public void writeMemberHeader(ClassDoc fieldType, String fieldTypeStr,
				String fieldDimensions, String fieldName);
		
		/**
		 * Write the footer.
		 * 
		 * @param member the member to write the header for.
		 */
		public void writeMemberFooter(FieldDoc member);
	}
	
	/**
	 * Write the serialized form for a given field.
	 */
	public interface SerialMethodWriter {
		
		/**
		 * Write the given heading.
		 * 
		 * @param heading the heading to write.
		 */
		public void writeHeader(String heading);
		
		/**
		 * Write a warning that no serializable methods exist.
		 * 
		 * @param msg the warning to print.
		 */
		public void writeNoCustomizationMsg(String msg);
		
		/**
		 * Write the header.
		 * 
		 * @param member the member to write the header for.
		 */
		public void writeMemberHeader(MethodDoc member);
		
		/**
		 * Write the footer.
		 * 
		 * @param member the member to write the header for.
		 */
		public void writeMemberFooter(MethodDoc member);
		
		/**
		 * Write the deprecated information for this member.
		 */
		public void writeDeprecatedMemberInfo(MethodDoc member);
		
		/**
		 * Write the description for this member.
		 */
		public void writeMemberDescription(MethodDoc member);
		
		/**
		 * Write the tag information for this member.
		 */
		public void writeMemberTags(MethodDoc member);
	}
}
